<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
	<title>新增角色</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/bootstrap-responsive.min.css"/>" rel="stylesheet">
	<link id="base-style" href="<c:url value="/css/style.css"/>" rel="stylesheet">
	<link id="base-style-responsive" href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/index.css"/>" rel="stylesheet">
	<link rel="shortcut icon" href="<c:url value="/img/favicon.ico"/>">
	<link href="<c:url value="/css/page.css"/>" rel="stylesheet">
	<%-- <link rel="stylesheet" type="text/css" href="<c:url value="/css/jquery.datetimepicker.css"/>"/> --%>
	<link href="<c:url value="/css/navuser.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/but.css"/>" rel="stylesheet">
	<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
	<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/layer/layer.js"/>"></script>
	<script src="<c:url value="/js/laydate/laydate.js"/>"></script>
	<%-- <script src="<c:url value="/js/build/jquery.datetimepicker.full.js"/>"></script> --%>
	<script src="<c:url value="/js/orgin.js"/>"></script>
	<script src="<c:url value="/js/filebut.js"/>"></script>
</head>
	<script type="text/javascript">
	 function closebutton() {
			var index = parent.layer.getFrameIndex(window.name);  
		 	parent.layer.close(index);  
		 }
	 function save(){
		 var formData = new FormData($("#customerform")[0]);
	     alert(formData);
	     $.ajax({  
	          url: '<%=basePath%>organization/saveRole',
	          type: 'POST',  
	          data: formData,  
	          async: false,  
	          cache: false,
	          contentType: false,  
	          processData: false,  
	          success: function (result) {
	                if("addok"==result){
	                    alert("添加角色成功");
	                    closebutton();
	                    window.parent.location.reload(); //刷新父页面
	                }else if("addno"==result){
	                    alert("添加角色失败");
	                }else if("updateok"==result){
	                	alert("修改角色成功");
	                    closebutton();
	                    window.parent.location.reload(); //刷新父页面
	                }else if("updateno"==result){
	                	alert("修改角色失败");
	                }else if("custNameExist"==result){
	                	alert("角色已经存在");
	                }
	          }
	     })
	 }
	</script>
<body>
	<div id="content" class="span10" style="width: 100%;background-color:#F9F9F9;">
				
				<div style="background-color:#FFF;height: 1200px">
				
				<form name="customerform" id="customerform" method="post">
					<input type="hidden" name="id" value="${rolemembers.id}">
					<input type="hidden" name="organizationid" value="${organizationid}">
					<div class="row-fluid content-table">
						<table class="table table-striped table-bordered bootstrap-datatable">
							<tbody>
								<tr>
									<td>角色名称</td>
									<td><input style="margin-left: -152px;" type="text" id="custName" name="name" value="${rolemembers.name}"></td>
								</tr>
								<tr>
									<td>角色类型</td>	
									<td>
									<c:if test="${rolemembers.type == 1 || rolemembers.type == null}">
										<input style="margin-left: -152px;" name="type" type="radio" checked="checked" value="1">角色
					                  	<input name="type" type="radio" value="2">岗位
					                </c:if>
					                <c:if test="${rolemembers.type == 2}">
					                	<input style="margin-left: -152px;" name="type" type="radio" value="1">角色
					                  	<input name="type" type="radio" value="2" checked="checked">岗位
					                </c:if>
									</td>
								</tr>
								<tr>
									<td>状态</td>
									<td>
										<select id="status" name="status" class="buildselect">
											<option value="">请选择</option>
											<option value="1" ${1==rolemembers.status?'selected':''}>关闭</option>
											<option value="0" ${0==rolemembers.status?'selected':''}>启用</option>
										</select>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</form>
			<div class="row-fluid content-table">
					<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0;">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button style="background-color: #dadada;color: #666;" type="button" onclick="closebutton();" id="output1">取消</button>
									<button class="but" onclick="save();">保存</button>
								</div>
							</td>
						</tr>
					  </tbody>
				  </table>            
				</div>
			</div>
		</div>	
</body>
</html>